Python dataclasses._create_fn
位置引数は3つ
name
args
body
文字列を作ってexecする
code:execされる文字列.py
# f-stringにより変数が埋め込まれる
def __create_fn__({local_vars}):
def {name}({args}){return_annotation}:
body
return {name}
ns['__create_fn__'](**locals)をreturn
nsは空の辞書でexecのlocals引数に渡る
The only callers are internal to this module, so no worries about external callers.